<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <title>密码生成器</title>
  <style>
    body { font-family: Arial; text-align: center; margin-top: 100px; }
    input { width: 300px; padding: 10px; font-size: 18px; }
    button { padding: 10px 20px; font-size: 18px; }
  </style>
</head>
<body>
  <h1>🔐 随机密码生成器</h1>
  <label for="password">生成的密码：</label>
  <input type="text" id="password" readonly title="生成的随机密码将显示在这里" placeholder="生成的密码将显示在这里">
  <br><br>
  <button onclick="generatePassword()">生成密码</button>

  <script>
    function generatePassword() {
      const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*";
      let pwd = "";
      for (let i = 0; i < 12; i++) {
        pwd += chars[Math.floor(Math.random() * chars.length)];
      }
      document.getElementById("password").value = pwd;
    }
  </script>
</body>
</html>
